package com.icode.web.mobile.android;

import com.icode.core.dto.house.BuildingTypeDTO;
import com.icode.core.dto.house.HouseInfoDTO;
import com.icode.core.model.house.BuildingType;
import com.icode.service.house.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-6-24
 * Time: 上午9:39
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("android_apartment")
public class AndroidApartmentController {

    @Autowired
    private HouseService houseService;

    @RequestMapping(value = "list")
    @ResponseBody
    public Object showApartment() {
        return houseService.findAllApartment();
    }

    @RequestMapping(value = "type/{houseBaseGuid}")
    @ResponseBody
    public Object showHouseType(@PathVariable String houseBaseGuid) {
        List<BuildingType> buildingTypes = houseService.findBuildingTypeByHouseBase(houseBaseGuid);
        List<BuildingTypeDTO> buildingTypeDTOs = BuildingTypeDTO.toDTOs(buildingTypes);
        return buildingTypeDTOs;
    }

    @RequestMapping(value = "info/{buildingTypeGuid}")
    @ResponseBody
    public Object showHouseInfo(@PathVariable String buildingTypeGuid) {
//        List<HouseInfoDTO> houseInfoDTOs = houseService.findHouseInfoByBuildingTypeGuid(buildingTypeGuid);
        return null;
    }

}
